package cn.com.doone.common.uc.oauth.validator;

import javax.servlet.http.HttpServletRequest;

import org.apache.oltu.oauth2.as.request.OAuthRequest;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.apache.oltu.oauth2.common.message.OAuthResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.com.doone.common.uc.domain.oauth.ClientDetails;

public class WeChatClientDetailValidator extends AbstractClientDetailsValidator {
	
	private static final Logger LOG = LoggerFactory.getLogger(WeChatClientDetailValidator.class);

	private static HttpServletRequest request;
	
	public WeChatClientDetailValidator(OAuthRequest oauthRequest, HttpServletRequest request) {
		super(oauthRequest);
		this.request = request;
	}

	@Override
	protected OAuthResponse validateSelf(ClientDetails clientDetails)
			throws OAuthSystemException {
		
		//validate client_secret
        /*final String clientSecret = (String) request.getAttribute("client_secret");
        if (clientSecret == null || !clientSecret.equals(clientDetails.getClientSecret())) {
            return invalidClientSecretResponse();
        }

        //validate redirect_uri
        final String redirectURI = (String) request.getAttribute("redirect_uri");
        if (redirectURI == null || redirectURI.indexOf(clientDetails.getRedirectUri()) != 0) {
            LOG.debug("Invalid redirect_uri '{}' by response_type = 'code', client_id = '{}'", redirectURI, clientDetails.getClientId());
            return invalidRedirectUriResponse();
        }*/
		
		return null;
	}

}
